#include "../../platform/win32/inc/stdafx.h"
#include "../common/inc/InternalCommon.h"
#include "../inc/Socket.h"

namespace	Platform
{

	namespace Network
	{

		CSocket::CSocket(){}

		CSocket::~CSocket(){}

		CSocket::CSocket(const CSocket &object)
		{
			(*this) = object;
		}

		CSocket& CSocket::operator=(const CSocket &object)
		{
			return (*this);
		}

		bool CSocket::operator==(const CSocket &object)
		{
			return (this == &object);
		}

		int CSocket::Socket(OUT Platform::System::IHandle *&handle, IN eNetworkProtocolType protocol)
		{
			return m_System.Socket(handle, protocol);
		}

		int CSocket::Close(IN Platform::System::IHandle *handle)
		{
			return m_System.Close(handle);
		}

		int CSocket::Close(IN Platform::System::IHandle *handle, IN const cstring &address)
		{
			return m_System.Close(handle, address);
		}

		int CSocket::Accept(OUT Platform::System::IHandle *&handle, IN Platform::System::IHandle *server, OUT cstring &address, OUT WORD &port)
		{
			return m_System.Accept(handle, server, address, port);
		}

		int CSocket::Bind(IN Platform::System::IHandle *handle, IN const cstring &address, IN WORD port)
		{
			return m_System.Bind(handle, address, port);
		}

		int CSocket::Connect(IN Platform::System::IHandle *handle, IN const cstring &address, IN WORD port, IN DWORD timeout)
		{
			return m_System.Connect(handle, address, port, timeout);
		}

		int CSocket::Multicast(IN Platform::System::IHandle *handle, IN const cstring &address, IN WORD port)
		{
			return m_System.Multicast(handle, address, port);
		}

		int CSocket::Listen(IN Platform::System::IHandle *handle, IN DWORD queue)
		{
			return m_System.Listen(handle, queue);
		}

		int CSocket::Send(IN Platform::System::IHandle *handle, IN const BYTE *buffer, IN DWORD length, IN DWORD flag)
		{
			return m_System.Send(handle, buffer, length, flag);
		}

		int CSocket::Receive(IN Platform::System::IHandle *handle, OUT BYTE *buffer, OUT DWORD &length, IN DWORD flag)
		{
			return m_System.Receive(handle, buffer, length, flag);
		}

		int CSocket::Send(IN Platform::System::IHandle *handle, IN const BYTE *buffer, IN DWORD length, IN DWORD flag, IN const cstring &address, IN WORD port)
		{
			return m_System.Send(handle, buffer, length, flag, address, port);
		}

		int CSocket::Receive(IN Platform::System::IHandle *handle, OUT BYTE *buffer, OUT DWORD &length, IN DWORD flag, IN_OUT cstring &address, IN_OUT WORD &port)
		{
			return m_System.Receive(handle, buffer, length, flag, address, port);
		}

		int CSocket::SetOption(IN Platform::System::IHandle *handle, IN eSocketOptionType option, IN const BYTE *parameter, IN DWORD length)
		{
			return m_System.SetOption(handle, option, parameter, length);
		}

		int CSocket::GetOption(IN Platform::System::IHandle *handle, IN eSocketOptionType option, OUT BYTE *parameter, OUT DWORD &length)
		{
			return m_System.GetOption(handle, option, parameter, length);
		}

		int CSocket::Control(IN Platform::System::IHandle *handle, IN eIOControlType control, IN_OUT DWORD &parameter)
		{
			return m_System.Control(handle, control, parameter);
		}

		int CSocket::Select(IN_OUT ISelectContainer *handle)
		{
			return m_System.Select(handle);
		}

		int CSocket::GetPeerAddress(IN Platform::System::IHandle *handle, OUT cstring &address, OUT WORD &port)
		{
			return m_System.GetPeerAddress(handle, address, port);
		}

		int CSocket::GetHostByName(IN const cstring &host, OUT cstring &address)
		{
			return m_System.GetHostByName(host, address);
		}

		DWORD CSocket::Ntohl(IN DWORD value)
		{
			return m_System.Ntohl(value);
		}

		DWORD CSocket::Htonl(IN DWORD value)
		{
			return m_System.Htonl(value);
		}

		WORD CSocket::Ntohs(IN WORD value)
		{
			return m_System.Ntohs(value);
		}

		WORD CSocket::Htons(IN WORD value)
		{
			return m_System.Htons(value);
		}

	}

}